import config from '../../utils/config';
import apiCreator from '../../utils/apiCreator';

const api = apiCreator();
const mainUrl = 'portfolio-server/maatProduct';
export default {
  saveCol: (query) => api.post(`${config.interfaces.type1}web-column/save`, query),
  // 获得交易模式
  queryById: (query) => api.get(`${config.interfaces.type5}${mainUrl}/queryById`, query),
  //获取真实股票持仓表
  stockTable: (query) => api.post(`${config.interfaces.type1}tradeAnaStkHoldInfo/getSearch`, query),
  // 获取真实表头
  queryShowCol: (query) => api.get(`${config.interfaces.type1}web-column/find`, query),
  // get真实组合展示操作行数据
  getSearchTotal: (query) => api.post(`${config.interfaces.type1}tradeAnaBndHoldInfo/getSearchTotal`, query),
  // get真实组合列表    需要等待接口完成 目前使用的是queryHolding
  queryRealDate: (query) => api.get(`${config.interfaces.type1}tradeAnaStkHoldInfo/queryBarraTotal`, query),
  // 获取产品组合列表
  queryProductTableList: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraProduct/getPortfolioList`, query),
  // 新增模拟组合
  addPortfolio: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraProduct/AddSimulationPort`, query),
  // 编辑模拟组合
  editPortfolio: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraProduct/editPortfolioList`, query),
  // 删除模拟组合
  deletePortfolio: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraProduct/removeSimulationPort`, query),
  // 查询持仓列表
  queryHoldData: (query) => api.get(`${config.interfaces.type5}maat-workstation/barraPosition/queryHolding`, query),
  // 确定调仓
  changePosition: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraPosition/adjustHolding`, query),
  // 券池导入
  poolExport: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraPosition/uploadCouponPool`, query),
  // 持仓模板导入
  mouldImport: (query) => api.uploadFile(`${config.interfaces.type10}maat-workstation/barraPosition/upload`, { type: query.type, portfolioId: query.portfolioId }, query.formData),
  // 查询交易管理列表
  queryTransactionData: (query) => api.get(`${config.interfaces.type10}maat-workstation/barraTransaction/queryTransaction`, query),
  // 导入交易
  importTransaction: (query) => api.uploadFile(`${config.interfaces.type5}maat-workstation/barraTransaction/upload`, { portfolioId: query.portfolioId }, query.formData),
  // 获取现金管理列表
  queryCashData: (query) => api.get(`${config.interfaces.type5}maat-workstation/barraCash/queryCash`, query),
  // 现金调整
  adjustCash: (query) => api.post(`${config.interfaces.type5}maat-workstation/barraCash/adjustCash`, query),
  // 持仓可选时间范围
  getTradetime: (query) => api.get(`${config.interfaces.type5}maat-workstation/barraPosition/getTradetime`, query),
  // 业绩基准下拉数据
  getPerformanceBenchmarks: (query) => api.get(`${config.interfaces.type5}maat-workstation/barraProduct/getPerformanceBenchmarks`, query),
  // 获取最新价
  getPreClosePx: (query) => api.post(`${config.interfaces.type5}instrument-server/stock/queryMarketQuations`, query),
};
